package com.zoe.app.enums;

/**
 * @author zoe.Zhang
 * @date 2022/06/10
 * @description
 */
public enum SexEnum {
    MAN("man", "男"),
    WOMAN("woman", "女"),
    ;
    private final String code;
    private final String msg;

    public String getCode() {
        return code;
    }

    SexEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 根据code获取中文描述的方法
     */
    public static String getMsgByCode(String code) {
        for (SexEnum sexEnum : values()) {
            if (sexEnum.code.equals(code)) {
                return sexEnum.msg;
            }
        }
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
